<?php 

include '../function.php';

$mysqli = @new mysqli("127.0.0.1", "root", "", "school");


if($mysqli->connect_errno){
	exit("链接失败,代码：".$mysqli->connect_errno."错误原因：".$mysqli->connect_error);
}

$mysqli->query("set names utf8");


$sql = "insert into stu (name,age) values('小小明1',40)";

$res = $mysqli->query($sql);


// $id = $mysqli->insert_id();

// if(!$res){
// 	exit("链接失败,代码：".$mysqli->errno."错误原因：".$mysqli->error);
// }


$sql = "select * from stu";

$res = $mysqli->query($sql);

$tempArr = array();

while ($row = $res->fetch_assoc()) {
	$tempArr[] =$row;
}


var_dump($tempArr);


// $res->free();
// $mysqli->close();














 ?>